package com.example.demo.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * JWT配置类
 * 从配置文件中读取JWT相关配置
 */
@Component
@ConfigurationProperties(prefix = "jwt")
public class JwtConfig {
    
    /**
     * JWT密钥 - 必须至少64字节(512位)才能用于HS512算法
     */
    private String secret = "mySecretKey1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
    
    /**
     * JWT过期时间（秒）
     */
    private long expiration = 7 * 24 * 60 * 60; // 7天
    
    /**
     * 刷新token过期时间（秒）
     */
    private long refreshExpiration = 30 * 24 * 60 * 60; // 30天
    
    /**
     * JWT头部名称
     */
    private String header = "Authorization";
    
    /**
     * JWT令牌前缀
     */
    private String prefix = "Bearer ";
    
    // Getter和Setter方法
    public String getSecret() {
        return secret;
    }
    
    public void setSecret(String secret) {
        this.secret = secret;
    }
    
    public long getExpiration() {
        return expiration;
    }
    
    public void setExpiration(long expiration) {
        this.expiration = expiration;
    }
    
    public long getRefreshExpiration() {
        return refreshExpiration;
    }
    
    public void setRefreshExpiration(long refreshExpiration) {
        this.refreshExpiration = refreshExpiration;
    }
    
    public String getHeader() {
        return header;
    }
    
    public void setHeader(String header) {
        this.header = header;
    }
    
    public String getPrefix() {
        return prefix;
    }
    
    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }
}
